<template>
	<view class="content">
		<view class="box">
			<view class="col">
				<view class="cover">
					<u--image radius="5" width="100%" height="350rpx" mode="aspectFill" :src="commodity.cover"></u--image>
				</view>
				<view class="name">{{commodity.name}}</view>
				<view class="artist">艺术家: {{commodity.artistName}}</view>
				<view class="price">
					<text class="l">数量: x1</text>
					<u-icon @click="show = true" :name="visibleIcon[commodity.visible]" color="#999999"></u-icon>
				</view>
			</view>
		</view>
		<u-action-sheet @close="show = false" :show="show" :safeAreaInsetBottom="true">
			<view class="sheet">
				<view @click="onClickVisible(k)" class="cell" v-for="(v, k) in commodityVisible" :key="k">{{v}}</view>
				<u-gap height="6" bgColor="#0a0a22"></u-gap>
				<view class="cell" @click="show = false">取消</view>
			</view>
		</u-action-sheet>
	</view>
</template>

<script>
	import {mapState, mapActions} from 'vuex'
	import {CollectionStatus, MarketType, commodityVisible} from '@/common/config/enums.js'
	export default {
		components: {
		},
		data() {
			return {
				show: false,
				visibleIcon: {
					0: 'lock-fill',
					1: 'eye-fill',
					2: 'lock-opened-fill'
				},
				commodityVisible,
				CollectionStatus,
				MarketType,
				id: '1512374911008194561',
				commodity: {}
			}
		},
		onLoad() {
			this.getDetail()
		},
		methods: {
			...mapActions('user', ['getOwnCollectionDetail']),
			getDetail(){
				this.getOwnCollectionDetail({id: this.id}).then(res => {	
					console.log(res)
					this.commodity = res.data
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content{
		padding: 20rpx 30rpx;
		.box{
			padding: 20rpx 10rpx;
			background-color: #0a0a22;
			border-top-left-radius: 20rpx;
			border-top-right-radius: 20rpx;
			.count{
				padding: 20rpx 10rpx 30rpx 10rpx;
				color: #cdcdcd;
				font-size: 25rpx;
				.n{
					color: #ffffff;
					font-size: 30rpx;
					padding-left: 20rpx;
				}
			}
			.grid-item{
				background-color: red;
			}
			.col{
				background-color: #484b5e;
				border-radius: 10rpx;
				width: 96%;
				margin-bottom: 20rpx;
				.cover{
					position: relative;
				}
				.name{
					color: #ffffff;
					font-size: 26rpx;
					padding: 10rpx 10rpx;
				}
				.artist{
					color: #999999;
					font-size: 22rpx;
					padding: 0rpx 10rpx;
				}
				.price{
					display: flex;
					justify-content: space-between;
					font-size: 22rpx;
					padding: 20rpx 10rpx 30rpx 10rpx;
					.r{
						color: #fac22b;
					}
				}
			}
		}
		.sheet{
			background-color: #0a0a22;
			padding: 0;
			margin: 0;
			.cell{
				background-color: #232639;
				height: 80rpx;
				line-height: 80rpx;
				border: 1rpx solid #0a0a22;
			}
			.u-gap{
				background-color: #0a0a22;
			}
		}
	}
</style>
